/**
 * Created by kangdaye on 16/6/5.
 */
app.controller('freightListCtr',["$scope","$rootScope","ngDialog","confirm","message","freightCache","freightService", function($scope,$rootScope,ngDialog,confirm,message,freightCache,freightService) {
    $scope.gridOptions = {
        url          : servicePath + 'freight/list',
        columnDefs   : freightCache.listTableHeader,
        selectAll    : true
    };

    $scope.delete = function(id){
        confirm({
            text:'确定要删除吗？',
            option:{
                go:function(){
                    var selectIds = angular.add($scope.gridOptions.selectData,'id');
                    freightService.delete({
                        ids : id || selectIds.toString()
                    },function(){
                        $scope.gridOptions.refresh();
                        message({text : '删除成功'});
                    });
                }
            }
        });
    };
}]);
